package com.bsoft.gol.editor.utils;

import java.io.Serializable;
import java.util.List;

/**
 * @description: 简化的分页返回
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public class SimplePageInfo<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    //总记录数
    private long total;
    //结果集
    private List<T> list;

    public SimplePageInfo() {
    }

    /**
     * 包装Page对象
     *
     * @param list
     */
    public SimplePageInfo(List<T> list) {
        this(list, 8);
    }

    /**
     * 包装Page对象
     *
     * @param list          page结果
     * @param totsl  总条数
     */
    public SimplePageInfo(List<T> list, int totsl) {
        this.list = list;
        this.total = totsl;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("PageInfo{");
        sb.append(", total=").append(total);
        sb.append(", list=").append(list);
        sb.append('}');
        return sb.toString();
    }
}
